package main

import (
	"encoding/json"
	"fmt"
)

type testApi_t1 struct {
	Name string `json:"name"`
}

func testapi_t1_req() {

	reqData := &testApi_t1{
		Name: "caosi",
	}

	jsonData, _ := json.Marshal(reqData)

	hc := &HttpClient{
		Url:  "http://localhost:8888/test/t2",
		Data: jsonData,
		Headers: map[string]string{
			"Content-Type": "application/json",
			"Connection":   "Close",
		},

		Callbak: testapi_t1_onresp,
	}
	hc.Post()

}

func testapi_t1_onresp(code int, body []byte) {
	fmt.Println("响应状态码:", code)
	fmt.Println("响应内容:", string(body))
}
